#!/usr/bin/env python
# -*- coding: utf-8 -*-
# type: ignore
"""
author : GQ
project : SwiftTestPlatform
date : 2022/4/1
"""

from lxhc_testcase.testconf import host, users
from apitest.utils.excelhandle import ExcelHandle

EH_HOST = ExcelHandle(host())
EH_USER = ExcelHandle(users())

is_prd_env = 0  # 0 = True 测试环境，1：生产环境
is_use_db = 0

host_target = "B2" if is_prd_env else "A2"
user_target = "D2" if is_prd_env else "A2"
pwd_target = "E2" if is_prd_env else "B2"
token_target = "F2" if is_prd_env else "C2"


class Constant(object):
    '''常量配置'''
    token_target = "F2" if is_prd_env else "C2"
    lxhc_host = EH_HOST.read_target(host_target)
    user = EH_USER.read_target(user_target)
    pwd = EH_USER.read_target(pwd_target)

    def user_login(self):
        return self.lxhc_host + '/api/front/login'

    def get_user(self):
        return EH_USER.read_target(user_target)

    def get_pwd(self):
        return EH_USER.read_target(pwd_target)

    def get_token(self):
        return EH_USER.read_target(token_target)

    # 以下是本模块的测试脚本
    def front_index(self):
        return self.lxhc_host + '/api/front/index'


    def color_config(self):
        return self.lxhc_host + '/api/front/index/color/config'


    def get_version(self):
        return self.lxhc_host + '/api/front/index/get/version'


    def front_wechat_program_my_temp(self):
        return self.lxhc_host + '/api/front/wechat/program/my/temp/list?type=beforePay'


    def front_coupons(self):
        return self.lxhc_host + '/api/front/coupons?page=1&limit=6'


    def front_seckill_index(self):
        return self.lxhc_host + '/api/front/seckill/index'


    def front_combination_index(self):
        return self.lxhc_host + '/api/front/combination/index'


    def front_bargain_index(self):
        return self.lxhc_host + '/api/front/bargain/index'


    def front_product_leaderboard(self):
        return self.lxhc_host + '/api/front/product/leaderboard'


    def front_index_product(self):
        return self.lxhc_host + '/api/front/index/product/4?page=1&limit=10'


    def front_share(self):
        return self.lxhc_host + '/api/front/share'

    # def d(self):
    #     return self.lxhc_host +'/api/front/wechat/program/my/temp/list?type=afterPay'
    #
    # def d(self):
    #     return self.lxhc_host +'/api/front/wechat/program/my/temp/list?type=createBargain'
    #
    # def d(self):
    #     return self.lxhc_host +'/api/front/wechat/program/my/temp/list?type=pink'
